package cn.juque.systemservice.config;

import cn.juque.common.aop.ExceptionAspect;
import cn.juque.common.thread.BaseOperatorThreadLocal;
import cn.juque.common.utils.ValidatorUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author nuoka
 */
@Configuration
@ComponentScans(value = {@ComponentScan("cn.hutool.extra.spring")})
public class SystemServiceMvcConfigurer implements WebMvcConfigurer {

    /**
     * 加密器
     *
     * @return BCryptPasswordEncoder
     */
    @Bean
    public BCryptPasswordEncoder bCryptPasswordEncoder() {
        return new BCryptPasswordEncoder();
    }

    @Bean
    public ValidatorUtil validatorUtil() {
        return new ValidatorUtil();
    }

    @Bean
    public ExceptionAspect exceptionAspect() {
        return new ExceptionAspect();
    }

    @Bean
    public BaseOperatorThreadLocal baseOperatorThreadLocal() {
        return new BaseOperatorThreadLocal();
    }
}
